//
//  RJCheckExplainView.m
//  AirQuality
//
//  Created by Po on 15/9/24.
//  Copyright © 2015年 Po. All rights reserved.
//

#import "RJCheckExplainView.h"
@interface RJCheckExplainView()

@property (strong, nonatomic) NSArray * data;

@end

@implementation RJCheckExplainView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        _isShow = NO;
//        [self updateInterface];
    }
    return self;
}

- (void)updateInterface
{
    
    
}


#pragma mark - function
- (void)setShow:(BOOL)isShow
{
    CGRect rect = self.frame;
    rect.origin.x = (isShow ? 0 : -ScreenWidth);
    _isShow = isShow;
    self.backgroundColor = [UIColor whiteColor];
    [UIView animateWithDuration:0.3 animations:^{
        [self setFrame:rect];
    }];
}

- (void)setStationNames:(NSArray *)stations
{
    _data = nil;
    _data = [NSArray arrayWithArray:stations];
    for (UIView * view in self.subviews) {
        [view removeFromSuperview];
    }
    
    for (NSUInteger i = 0; i < stations.count; i ++) {
        CGFloat width = ScreenWidth / 3;
        CGFloat height = 40;
        UILabel * label = [[UILabel alloc] initWithFrame:CGRectMake(width * (i % 3), height * (i / 3), width, height)];
        [label setText:stations[i]];
        [label setBackgroundColor:[RJTools getLineColors][i]];
        [label setTextAlignment:NSTextAlignmentCenter];
        [label setTextColor:[UIColor whiteColor]];
        [self addSubview:label];
    }
}
@end
